package team.bluepen.supermarket.data.dao;

import org.apache.hadoop.hbase.util.Bytes;

/**
 * @author Kai
 */
public class StringBytesConverter implements BytesConverter {
    public static final StringBytesConverter INSTANCE = new StringBytesConverter();

    public StringBytesConverter() {}

    @Override
    public byte[] convert(Object obj) {
        if (!(obj instanceof String)) {
            return new byte[0];
        }

        return Bytes.toBytes((String) obj);
    }
}
